package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 补贴设置(0-未设置,1-自动按比例分摊,2-手动设置)
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum SubsidyStateEnum {

    NO(0, "未设置"),
    AUTO(1, "自动按比例分摊"),
    MANUAL(2, "手动设置"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    SubsidyStateEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static SubsidyStateEnum typeOf(Integer value) {
        SubsidyStateEnum[] values = SubsidyStateEnum.values();
        for (SubsidyStateEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static SubsidyStateEnum typeOf(String name) {
        SubsidyStateEnum[] values = SubsidyStateEnum.values();
        for (SubsidyStateEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
